 <extend name="Index:info" />
<block name="title">新闻中心</block>
<block name="body">

	<div class="panel admin-panel">
		<div class="panel-head"><strong class="icon-reorder">前台用户列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
		<div class="padding border-bottom">
			<form method="get" action="" id="getform">
			<ul class="search" style="padding-left:10px;">
				<li> <a class="button border-main icon-plus-square-o" href="{:U('user/huser_add')}"> 添加账号</a> </li>
				<li>搜索：</li>
				<li>vip
				
					<select name="coupon" id="vip" class="inputo input" onchange="changesearch()" style="width:60px; line-height:17px; display:inline-block">
						<option value="">选择</option>
						<foreach name="coupon" item="val" >
							<option value="{$val.coupon_id}" <if condition="$get['coupon'] eq $val['coupon_id']">selected</if>>{$val.coupon_name}</option>
						</foreach>
					</select>
					&nbsp;&nbsp;
					年龄
					<select name="age" id="age" class="inputt input" onchange="changesearch()"  style="width:60px; line-height:17px;display:inline-block">
						<option value="">选择</option>
						
					</select>
					
					&nbsp;&nbsp;
					性别
					<select name="sex" class="inputs input" onchange="changesearch()"  style="width:60px; line-height:17px;display:inline-block">
						<option value="">选择</option>
						<foreach name="sex" item="val">
						<option value="{$val.sex_id}" <if condition="$get['sex'] eq $val['sex_id']">selected</if>>{$val.sex_name}</option>
						</foreach>
					</select>
					
					<script>
						for(var i=18;i<=100;i++){
							$('#age').append("<option id='" + i + "' value='" + i + "'>"+ i +"</option>");
							if("{$get.age}" == i){
								$('#'+i).attr('selected','selected');
							}
						}
					</script>
				</li>
				<if condition="$iscid eq 1">
					<li>
						<select name="cid" class="input" style="width:200px; line-height:17px;" onchange="changesearch()">
							<option value="">请选择分类</option>
							<option value="">产品分类</option>
							<option value="">产品分类</option>
							<option value="">产品分类</option>
							<option value="">产品分类</option>
						</select>
					</li>
				</if>
				<li>
					<input type="text" placeholder="请输入搜索关键字" name="keywords" class="input"  <if condition="$get['keywords'] neq ''"> value="{$get.keywords}" </if> style="width:250px; line-height:17px;display:inline-block" />
					<a href="javascript:void(0)" class="button border-main icon-search" onclick="submit();" > 搜索</a></li>
			</ul>
			</form>
		</div>
		<form method="post" action="" id="listform">
	<table class="table table-hover text-center">
		<tr>
			<th width="100" style="text-align:left; padding-left:20px;"></th>
			<th width="10%">Id</th>
			<th>账号</th>
			<th>头像</th>
			<th>昵称</th>
			<th>性别</th>
			<th width="10%">创建时间</th>
			<th width="310">操作</th>
		</tr>
      <foreach name="huser" item="val">
		<tr>
			<td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id[]" value="{$val.id}" />
			</td>
			<td>{$val.id}</td>
			<td>{$val.user_name}</td>
			<td width="10%"><img src="__PUBLIC__/{$val.image_id}" alt="" width="70" height="50" /></td>
			<td>{$val.nickname}</td>
			<td><font color="#00CC99">{$val.sex_name}</font></td>
			<td>{$val.create_time|date="Y-m-d H:i:s",###}</td>
			<td><div class="button-group"> <a class="button border-main" href="{:U('user/huser_select')}?id={$val.id}"><span class="icon-edit"></span>查询</a> <a class="button border-red" href="{:U('user/huser_del')}?id={$val.id}" onclick="return del(1,1,1)"><span class="icon-trash-o"></span> 删除</a> </div></td>
		</tr>
	</foreach >

          <tr>
        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>
          全选 </td>
			  <td colspan="7" style="text-align:left;padding-left:20px;">
			  <a href="javascript:;" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a></td>
      </tr>
      <tr>
		  <style>
			  .page div{font-size:20px;width:600px;margin:0 auto;}
			  .page div a{color:#00a2d4;margin: 0 5px 0 5px;display:block;width:40px;height:30px;border:1px solid #ddd;float:left;border-radius:5px;}
			  .page div a:hover{color:#fff;background-color:#00aaee;}
			  .page div span{margin: 0 5px 0 5px;display:block;width:40px;height:30px;border:1px solid #d4d4d4;float:left;border-radius:5px;}
			  .page div span:hover{color:#fff;background-color:#00aaee;}
			  .page div .first,.page div .prev,.page div .next,.page div .end{width:100px;}
		  </style>
		  <td colspan="8" class="page" id="page">{$page}</td>
      </tr>
    </table>
	</form>
  </div>

<script type="text/javascript">
//搜索
function changesearch(){
	
}

function submit(){
	$("#getform").submit();
}

//单个删除
function del(id,mid,iscid){
	if(confirm("您确定要删除吗?")){

	}
}

//全选
$("#checkall").click(function(){
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

//批量删除
function DelSelect(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false;
		$("#listform").submit();
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}

//批量排序
function sorts(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){

		$("#listform").submit();
	}
	else{
		alert("请选择要操作的内容!");
		return false;
	}
}


//批量首页显示
function changeishome(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){

		$("#listform").submit();
	}
	else{
		alert("请选择要操作的内容!");

		return false;
	}
}

//批量推荐
function changeisvouch(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){


		$("#listform").submit();
	}
	else{
		alert("请选择要操作的内容!");

		return false;
	}
}

//批量置顶
function changeistop(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){

		$("#listform").submit();
	}
	else{
		alert("请选择要操作的内容!");

		return false;
	}
}


//批量移动
function changecate(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){

		$("#listform").submit();
	}
	else{
		alert("请选择要操作的内容!");

		return false;
	}
}

//批量复制
function changecopy(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){
		var i = 0;
	    $("input[name='id[]']").each(function(){
	  		if (this.checked==true) {
				i++;
			}
	    });
		if(i>1){
	    	alert("只能选择一条信息!");
			$(o).find("option:first").prop("selected","selected");
		}else{

			$("#listform").submit();
		}
	}
	else{
		alert("请选择要复制的内容!");
		$(o).find("option:first").prop("selected","selected");
		return false;
	}
}

</script>

</block>